package com.cqndt.disaster.device.service.impl;

import java.util.Map;
import java.util.List;
import org.springframework.stereotype.Service;
import com.cqndt.disaster.device.vo.TabAlarmInfoVo;
import com.cqndt.disaster.device.dao.TabAlarmInfoMapper;
import com.cqndt.disaster.device.service.TabAlarmInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TabAlarmInfoServiceImpl implements TabAlarmInfoService{
	
    @Autowired
    private TabAlarmInfoMapper tabAlarmInfoMapper;

    @Override
    @Transactional(readOnly=true)
    public List<Map<String,Object>> TypelistTabAlarmInfo(TabAlarmInfoVo vo) {

        if("40".equals(vo.getDeviceType())){
            return tabAlarmInfoMapper.getDriftalarm(vo);
        }
        if("4".equals(vo.getDeviceType())){
            return tabAlarmInfoMapper.getGnssalarm(vo);
        }
        if("10".equals(vo.getDeviceType())||"11".equals(vo.getDeviceType())){
            return tabAlarmInfoMapper.getRainalarm(vo);
        }

        throw new RuntimeException("没有相应类型");
    }

    @Override
    public List<TabAlarmInfoVo> listTabAlarmInfo(TabAlarmInfoVo vo) {
        return tabAlarmInfoMapper.listTabAlarmInfo(vo);
    }
    @Override
    @Transactional(readOnly=true)
    public List<Map<String,Object>> getAlarmsLevelByMonitorType(TabAlarmInfoVo vo) {
        List<Map<String,Object>> alarmsLevelByMonitorType = tabAlarmInfoMapper.getAlarmsLevelByMonitorType(vo);
        return alarmsLevelByMonitorType;
    }
    @Override
    @Transactional(readOnly=true)
    public TabAlarmInfoVo getDetailById(String id) {
        return tabAlarmInfoMapper.getDetailById(id);
    }
    @Override
    @Transactional(readOnly=true)
    public TabAlarmInfoVo getDetailByMonitorId(TabAlarmInfoVo vo) {
        return tabAlarmInfoMapper.getDetailByMonitorId(vo);
    }
}